<template>
  <div class="item-wrapper">
    <div class="left"><el-image :src="imgUrl" fit="cover" /></div>
    <div class="right">
      <div class="name">{{ name }}</div>
      <div class="type-status">
        <span>{{ typeLabel }}</span>
        <span>|</span>
        <span>{{ statusLabel }}</span>
      </div>
      <div class="price">
        <div class="value">{{ investment }}</div>
        <div class="unit">万</div>
        <div class="label">拟投资额</div>
      </div>
    </div>
  </div>
</template>

<script lang="ts">
import Vue from 'vue'
export default Vue.extend({
  components: {},
  props: {
    dataObj: {
      type: Object,
      default: () => ({}),
    },
  },
  data() {
    return {}
  },
  computed: {
    investment() {
      const { investment } = this.dataObj?.data
      return investment || '--'
    },
    statusLabel() {
      const { statusLabel } = this.dataObj?.data
      return statusLabel || '--'
    },
    typeLabel() {
      const { typeLabel } = this.dataObj?.data
      return typeLabel || '--'
    },
    name() {
      const { name } = this.dataObj?.data
      return name || '--'
    },
    imgUrl() {
      const { imgList } = this.dataObj?.data
      if (imgList && imgList.length > 0) {
        return imgList[0].url
      }
      return 'https://iph.href.lu/109x100'
    },
  },
})
</script>
<style lang="scss" scoped>
.item-wrapper {
  display: flex;
  margin: 20px 0;

  .left {
    flex: none;
    width: 109px;
    height: 100px;
    border-radius: 6px;
    overflow: hidden;

    .el-image {
      width: 100%;
      height: 100%;
    }
  }

  .right {
    padding-left: 14px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;

    .name {
      color: #1e1f20;
      font-size: 16px;
    }

    .type-status {
      @apply space-x-1;
      display: flex;
      color: #797c81;
      font-size: 14px;
    }

    .price {
      display: flex;
      align-items: baseline;

      .value,
      .unit {
        color: #ff6f36;
        font-size: 18px;
        font-weight: bold;
      }

      .label {
        margin-left: 5px;
        font-size: 12px;
        color: #797c81;
      }
    }
  }
}
</style>
